package com.csot.ry.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.csot.common.annotation.Log;
import com.csot.common.core.controller.BaseController;
import com.csot.common.core.domain.AjaxResult;
import com.csot.common.enums.BusinessType;
import com.csot.ry.domain.TZtIp;
import com.csot.ry.service.ITZtIpService;
import com.csot.common.utils.poi.ExcelUtil;
import com.csot.common.core.page.TableDataInfo;

/**
 * 中泰ipController
 * 
 * @author csot
 * @date 2025-07-20
 */
@RestController
@RequestMapping("/zt/ip")
public class TZtIpController extends BaseController
{
    @Autowired
    private ITZtIpService tZtIpService;

    /**
     * 查询中泰ip列表
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:list')")
    @GetMapping("/list")
    public TableDataInfo list(TZtIp tZtIp)
    {
        startPage();
        List<TZtIp> list = tZtIpService.selectTZtIpList(tZtIp);
        return getDataTable(list);
    }

    /**
     * 导出中泰ip列表
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:export')")
    @Log(title = "中泰ip", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TZtIp tZtIp)
    {
        List<TZtIp> list = tZtIpService.selectTZtIpList(tZtIp);
        ExcelUtil<TZtIp> util = new ExcelUtil<TZtIp>(TZtIp.class);
        util.exportExcel(response, list, "中泰ip数据");
    }

    /**
     * 获取中泰ip详细信息
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tZtIpService.selectTZtIpById(id));
    }

    /**
     * 新增中泰ip
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:add')")
    @Log(title = "中泰ip", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TZtIp tZtIp)
    {
        return toAjax(tZtIpService.insertTZtIp(tZtIp));
    }

    /**
     * 修改中泰ip
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:edit')")
    @Log(title = "中泰ip", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TZtIp tZtIp)
    {
        return toAjax(tZtIpService.updateTZtIp(tZtIp));
    }

    /**
     * 删除中泰ip
     */
    @PreAuthorize("@ss.hasPermi('zt:ip:remove')")
    @Log(title = "中泰ip", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tZtIpService.deleteTZtIpByIds(ids));
    }
}
